package com.example.schooljava.controller;


import com.example.schooljava.annotation.RequestLimit;
import com.example.schooljava.pojo.entity.RoleRoute;
import com.example.schooljava.service.impl.RoleRouteServiceImpl;
import com.example.schooljava.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LDH
 * @since 2022/08/22
 */
@RestController
@RequestMapping("/school/role-route")
@RequestLimit(maxCount = 5,second = 2)
@Api(tags = "角色路由权限模块")
public class RoleRouteController {

    @Autowired
    private RoleRouteServiceImpl roleRouteService;

    @ApiOperation(value = "添加权限",notes = "<span style='color:red;'>详细描述：</span>&nbsp;系统管理员给身份添加权限")
    @PostMapping(name = "系统管理员")
    public Result setRoleRoute(RoleRoute roleRoute){
        return roleRouteService.setRoleRoute(roleRoute);
    }

    @ApiOperation(value = "删除身份权限",notes = "<span style='color:red;'>详细描述：</span>&nbsp;系统管理员删除身份对应的权限")
    @DeleteMapping(name = "系统管理员")
    public Result delRoleRoute(ArrayList<String> list){
        return roleRouteService.delRoelRoute(list);
    }

}
